using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IShop.BackEnd;

public partial class mainpage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    bool isAuthenticated = false;
    string name = "";
    protected bool IsLogedIn()
    {
        if (isAuthenticated) return true;
        return this.Page.User.Identity.IsAuthenticated;
    }

    protected string GetLoginName()
    {
        if (isAuthenticated) return name;
        return this.Page.User.Identity.Name;
    }

    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        UserController userController = new UserController();
        if (userController.CheckUser(tbLogin.Text, tbPassword.Text))
        {
            FormsAuthentication.SetAuthCookie(tbLogin.Text, false);
            isAuthenticated = true;
            name = tbLogin.Text;
        }
    }
}
